﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AddToChucHanhChinh.ascx.cs" Inherits="Viewer.ToChucHanhChinh.UserControl.AddToChucHanhChinh" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<ext:XScript runat="server">
    <script type="text/javascript">
        function Validate() {
            if (CheckData()){
                return true;
            }
            else{ 
                Ext.MessageBox.alert('Lỗi', 'Bạn chưa nhập đủ các trường cần thiết!');
                return false;                 
            }
        }
        
         function CheckData()
        {
      
            if(#{txtTenToChucHanhChinh}.getValue()=='')
            {
                return false;
            }
           
             if(#{cboLoaiToChuc}.getValue()=='')
            {
                return false;
            }
            
            return true;
        }
    </script>
</ext:XScript>
<ext:Window ID="wdAddToChucHanhChinh" runat="server" Width="490" AutoHeight="true" Modal="true"
    Hidden="true"  Title="Add New " Icon="Add" BodyCssClass="window">
    <Items>
        <ext:Container runat="server" Layout="FormLayout" LabelWidth="150" LabelSeparator="">
            <Items>
                <ext:Hidden runat="server" ID="hdfType"></ext:Hidden>
                <ext:Hidden runat="server" ID="hdfToChucHanhChinhID" />
                <ext:Hidden runat="server" ID="hdfToChucHanhChinhIDCha" />
                <ext:Hidden runat="server" ID="hdfToChucHanhChinhLevel" />
                <ext:Hidden runat="server" ID="hdfLoaiToChucHanhChinh" />
                <ext:TextField ID="txtTenToChucHanhChinh" runat="server" Width="300" FieldLabel="Tên tổ chức" />
                <ext:ComboBox ID="cboLoaiToChuc" runat="server" DisplayField="CodeValue" ValueField="CodeID"
                    EmptyText="" Width="300" FieldLabel="Chọn loại tổ chức">
                    <Store>
                        <ext:Store ID="storeLoaiToChuc" runat="server">
                            <Reader>
                                <ext:JsonReader IDProperty="CodeID">
                                    <Fields>
                                        <ext:RecordField Name="CodeID" />
                                        <ext:RecordField Name="CodeValue" />
                                    </Fields>
                                </ext:JsonReader>
                            </Reader>
                        </ext:Store>
                    </Store>
                </ext:ComboBox>
                <ext:TextField ID="txtToChucHanhChinhTrucThuoc" Text="" ReadOnly="true" FieldLabel="Tổ chức trực thuộc" />
                <ext:TextField ID="txtGhiChu" runat="server" Width="300" FieldLabel="Ghi chú" />
            </Items>
        </ext:Container>
        
    </Items>
    <Buttons>
        <ext:Button ID="btnSave" runat="server" Text="Lưu" Icon="Disk">
            <Listeners>
                <Click Handler=" return Validate();  " />
            </Listeners>
            <DirectEvents>
                <Click OnEvent="btnSave_Click">
                </Click>
            </DirectEvents>
        </ext:Button>
        <ext:Button ID="Button1" runat="server" Text="Đóng" Icon="Cancel">
            <Listeners>
                <Click Handler="#{wdAddToChucHanhChinh}.hide();" />
            </Listeners>
        </ext:Button>
    </Buttons>
</ext:Window>